Skip to content

Conversation

@DJDavies2
Copy link
Contributor

I think this fixes #80.

The problem here is that there are pointers that are becoming undefined because they are being associated with something that does not have the target attribute. This can happen like this:

integer :: a
integer, pointer :: b

call sub(a,b)

....

subroutine sub(a,b)
integer, target :: a
integer,pointer :: b
b => a
end subroutine sub

The pointer assignment in sub is valid. However when sub returns it is not valid to assume that b is associated with a in the calling routine because a does not have the target attribute in the calling rouitne; b becomes undefined.

I have added the target attributes where necessary to get this test to work.

@wdeconinck
Copy link
Collaborator

That's great @DJDavies2 thanks for this!
Did you also run with the F08 MPL version, as this is the deprecated F77 based version ?

@DJDavies2
Copy link
Contributor Author

I have run it with other compilers and it seems fine, but I'm not sure if I can get NAG to use the f08 version.

@wdeconinck
Copy link
Collaborator

I have run it with other compilers and it seems fine, but I'm not sure if I can get NAG to use the f08 version.

Thanks, that could always come later then.

@wdeconinck wdeconinck merged commit a8ccaa7 into ecmwf-ifs:develop Jan 26, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants